<div id="panel-button" class="row">
	<div class="col-md-12">
		<div class="panel panel-default">
			<div class="panel-body text-right">
				<div class="col-sm-4 pull-left">
					{{Form::text('filter', null, array('id' => 'filter', 'class' => 'form-control', 'placeholder' => trans('form.filter')))}}
				</div>
				{{Form::button(trans('form.create'), array('class' => 'btn btn-success', 'id' => 'create'))}}
			</div>
		</div>
	</div>
</div>

<div id="panel-button-fixed" class="row hidden">
	<div class="col-md-12">
		<div class="panel panel-default">
			<div class="panel-body text-right">
				<div class="col-sm-4 pull-left">
					{{Form::text('filter', null, array('id' => 'filter', 'class' => 'form-control', 'placeholder' => trans('form.filter')))}}
				</div>
				{{Form::button(trans('form.create'), array('class' => 'btn btn-success', 'id' => 'create'))}}
			</div>
		</div>
	</div>
</div>

@if(Session::has('error'))
	<div id="panel-error" class="row hidden">
		<div class="col-md-12">
			<div class="panel panel-red panel-minimal">
				<header class="panel-heading">{{trans('form.form_error')}}</header>
				<div id="error-content" class="panel-body">
					{{Session::get('message', 'Something is error!')}}
				</div>
			</div>
		</div>
	</div>
@endif
<div class="row">
	<div class="col-md-12">
		<div class="panel panel-default">
			<div class="panel-body">
				<div class="table-responsive">
					<table class="table table-striped footable" data-filter="#filter" data-page-size="10" data-filter-minimum="1">
						<thead>
							<tr>
								<th>{{trans('order.customer_name')}}</th>
								<th data-type="numeric">{{trans('order.dept')}}</th>
								<th data-type="numeric">{{trans('order.subtotal')}}</th>
								<th data-type="numeric">{{trans('form.payment')}}</th>
								<th data-type="numeric">{{trans('form.refund')}}</th>
								<th data-type="numeric">{{trans('form.sale')}}</th>
								<th data-type="numeric">{{trans('form.remaining')}}</th>
							</tr>
						</thead>
						<tbody>
							<?php
								$dept      = 0;
								$total     = 0;
								$payment   = 0;
								$refund    = 0;
								$sale      = 0;
								$remaining = 0;
							?>
							@foreach($result as $id => $row)
							<?php
								$dept      += $row['dept'];
								$total     += $row['total'];
								$payment   += $row['payment'];
								$refund    += $row['refund'];
								$sale      += $row['sale'];
								$remaining += $row['remaining'];
							?>
							<tr id="order" data-id="{{$id}}">
								<td>{{$row['name']}}</td>
								<td class="text-right">{{MoneyFormat::format($row['dept'])}}</td>
								<td class="text-right">{{MoneyFormat::format($row['total'])}}</td>
								<td class="text-right">{{MoneyFormat::format($row['payment'])}}</td>
								<td class="text-right">{{MoneyFormat::format($row['refund'])}}</td>
								<td class="text-right">{{MoneyFormat::format($row['sale'])}}</td>
								<td class="text-right">{{MoneyFormat::format($row['remaining'])}}</td>
							</tr>
							@endforeach
						</tbody>
						<tfoot>
							<tr>
								<td>{{trans('form.total')}}</td>
								<td>{{MoneyFormat::format($dept)}}</td>
								<td>{{MoneyFormat::format($total)}}</td>
								<td>{{MoneyFormat::format($payment)}}</td>
								<td>{{MoneyFormat::format($refund)}}</td>
								<td>{{MoneyFormat::format($sale)}}</td>
								<td>{{MoneyFormat::format($remaining)}}</td>
							</tr>
							<tr>
								<td colspan="10" class="text-right">
									<ul class="pagination pagination-sm"></ul>
								</td>
							</tr>
						</tfoot>
					</table>
				</div>
			</div>
		</div>
	</div>
</div>

<script type="text/javascript">
$(document).ready(function() {
	

	$('.footable').footable();
});
</script>
<style type="text/css">
table thead th{
	text-align: center;
}

table tbody{
	height: 100px;
	overflow: hidden;
}

.number{
	width: 95px;
	text-align: right;
}
</style>